﻿<!DOCTYPE html>
<html>
<head>
    <meta charset=utf-8 />
    <title></title>
    <link href="../../Content/jquery-easyui-1.3.1/themes/icon.css" rel="stylesheet" />
    <link href="../../Content/jquery-easyui-1.3.1/themes/default/easyui.css" rel="stylesheet" />
    <link href="../../Content/Site.css" rel="stylesheet" />
    <script src="../../Content/jquery-easyui-1.3.1/jquery-1.8.0.min.js"></script>
    <script src="../../Content/jquery-easyui-1.3.1/jquery.easyui.min.js"></script>
    <script src="../../Content/jquery-easyui-1.3.1/locale/easyui-lang-zh_CN.js"></script>
    @*修改时间格式的Js文件*@
    <script src="../../Content/jquery-easyui-1.3.1/datapattern2.js"></script>

    <script src="~/Scripts/jquery.unobtrusive-ajax.min.js"></script>

    <script type="text/javascript">

        function func1() {

            var strHtmlDefault = '<iframe id="DeviceManageMentfrmWorkArea" width="100%" height="100%" frameborder="0" scrolling="yes" src="/Collector/Index"></iframe>';
            
            if ($("#DeviceManageMentTabs").tabs('exists', '所有采集器')) {
                $('#DeviceManageMentTabs').tabs('select', '所有采集器');
            } else {
                $('#DeviceManageMentTabs').tabs('add', {
                    title: '所有采集器',
                    closable: true,
                    content: strHtmlDefault
                });
            }
        }
       
        function addLoadEvent(func){
            var oldonload=window.onload;
            if(typeof window.onload!="function"){
                window.onload=func;
            }
            else{
                window.onload=function(){
                    oldonload();
                    func();
                }
            }
        }
        
        var url;

        function save_collector() {
            $('#fm_collector').form('submit', {
                url: url,
                onSubmit: function () {
                    return $(this).form('validate');
                },
                success: function (result) {
                    if (result == "OK") {
                        $('#dlg_collector').dialog('close');
                        $.messager.alert("提示", "操作成功!");
                        window.location.reload();//刷新当前页面.
                        //或者下方刷新方法
                        //parent.location.reload();//刷新父亲对象（用于框架）--需在iframe框架内使用
                        // opener.location.reload();//刷新父窗口对象（用于单开窗口
                        //top.location.reload();//刷新最顶端对象（用于多开窗口）
                      
                    }
                    else {
                        $.messager.alert("提示", result);
                    }
                }
            });
        }

        function save_lampcontroller() {
            $('#fm_lampcontroller').form('submit', {
                url: url,
                onSubmit: function () {
                    return $(this).form('validate');
                },
                success: function (result) {
                    if (result == "OK") {
                        $('#dlg_lampcontroller').dialog('close');
                        $.messager.alert("提示", "操作成功!");
                        window.location.reload();//刷新当前页面.
                      }
                    else {
                        $.messager.alert("提示", result);
                    }
                }
            });
        }

        $(function () {
           //初始化 
            addLoadEvent(func1);
           //实例化树形菜单
            $("#DeviceManageMentTree").tree({
                url: '/DeviceManagement/initTree',
                lines: true,
                animate: true,
                //dnd:true,
                onContextMenu: function(e,node){
                    e.preventDefault();
                    $(this).tree('select',node.target);
                    $('#mm').menu('show',{
                        left: e.pageX,
                        top: e.pageY
                    });
                },
                onClick: function (node) {
                    //展开
                    var node = $('#DeviceManageMentTree').tree('getSelected');
                    $('#DeviceManageMentTree').tree('expand', node.target);
                    //重定向
                    if (node.attributes) {
                        Open(node.text, node.attributes.url);
                    }
                }
            });
            //在右边center区域打开菜单，新增tab
            function Open(text, url) {
                var strHtml = '<iframe id="DeviceManageMentfrmWorkArea" width="100%" height="100%" frameborder="0" scrolling="yes" src="' + url + '"></iframe>';
                if ($("#DeviceManageMentTabs").tabs('exists', text)) {
                    $('#DeviceManageMentTabs').tabs('select', text);
                } else {
                    $('#DeviceManageMentTabs').tabs('add', {
                        title: text,
                        closable: true,
                        content: strHtml
                    });
                }
            }

            //绑定tabs的右键菜单
            $("#DeviceManageMentTabs").tabs({
                onContextMenu: function (e, title) {
                    e.preventDefault();
                    $('#DeviceManageMentTabsMenu').menu('show', {
                        left: e.pageX,
                        top: e.pageY
                    }).data("tabTitle", title);
                }
            });

            //实例化menu的onClick事件
            $("#DeviceManageMentTabsMenu").menu({
                onClick: function (item) {
                    CloseTab(this, item.name);
                }
            });

            //几个关闭事件的实现
            function CloseTab(menu, type) {
                var curTabTitle = $(menu).data("tabTitle");
                var tabs = $("#DeviceManageMentTabs");

                if (type === "close") {
                    tabs.tabs("close", curTabTitle);
                    return;
                }

                var allTabs = tabs.tabs("tabs");
               
                var closeTabsTitle = [];

                $.each(allTabs, function () {
                    var opt = $(this).panel("options");
                    if (opt.closable && opt.title != curTabTitle && type === "Other") {
                        closeTabsTitle.push(opt.title);
                    } else if (opt.closable && type === "All") {
                        closeTabsTitle.push(opt.title);
                    }
                });

                for (var i = 0; i < closeTabsTitle.length; i++) {
                    tabs.tabs("close", closeTabsTitle[i]);
                }
            }
        });

        function append() {
            var t = $('#DeviceManageMentTree');
            var node = t.tree('getSelected');
            if (node) {
                if (node.attributes) {
                    var type = node.attributes.type;
                    var pid = node.attributes.pid;
                    if (type == "root")
                    {
                        $('#dlg_collector').dialog('open').dialog('setTitle', '新建采集器');
                        $('#fm_collector').form('clear');
                        url = "Regist_Collector";
                    }
                     else if (type == "collector")
                    {
                        $('#dlg_lampcontroller').dialog('open').dialog('setTitle', '在该采集器下新建控制器');
                        $('#fm_lampcontroller').form('clear');
                        $('#CollectorID').val(pid);
                        alert("CollectorID:" + $('#CollectorID').val());

                        url = "Regist_LampController";

                    }
                 }
            }
        }
       
        function removeit() {
            
            var t = $('#DeviceManageMentTree');
            var node = t.tree('getSelected');
            if (node) {
                if (node.attributes) {
                    var type = node.attributes.type;
                    var pid = node.attributes.pid;
                    if (type == "collector")//删除采集器
                    {
                        $.messager.confirm("删除信息", "删除采集器信息会将该采集器下的所有控制器全部删除，您确认删除该采集器的信息吗？", function (DeleteInfo) {
                            if (DeleteInfo) {
                                $.post("Delete_Collector", { ID: pid }, function (data) {
                                    if (data == "OK") {
                                        $.messager.alert("友情提示", "删除成功!");
                                        window.location.reload();//刷新当前页面.
                                    }
                                    else {
                                        $.messager.alert("友情提示", data);
                                    }
                                });
                            }
                        });
                       
                        
                    }
                    else if (type == "lampcontroller")//删除该采集器下面的控制器
                    {
                        $.messager.confirm("删除信息", "您确认删除该控制器的信息吗？", function (DeleteInfo) {
                            if (DeleteInfo) {
                                $.post("Delete_LampController", { ID: pid }, function (data) {
                                    if (data == "OK") {
                                        $.messager.alert("友情提示", "删除成功!");
                                        window.location.reload();//刷新当前页面.
                                    }
                                    else {
                                        $.messager.alert("友情提示", data);
                                    }
                                });
                            }
                        });

                    }
                }
            }
        }

        function edit() {
            var t = $('#DeviceManageMentTree');
            var node = t.tree('getSelected');
            if (node) {
                if (node.attributes) {
                    var type = node.attributes.type;
                    var pid = node.attributes.pid;

                    if (type == "collector")//修改采集器
                    {
                        $('#dlg_collector_update').dialog('open').dialog('setTitle', '修改采集器');
                        $('#fm_collector_update').form('clear');
                        //异步获取采集器信息
                        $.getJSON("/DeviceManagement/BindCollectorInfo", { ID: pid }, function (date) {
                            $("#CollectorID1").val(date.ID);
                            $("#Name1").val(date.Name);
                            //所属采集器类型
                            $("#TypeID1").combobox('select', date.TypeID);
                            $("#IP1").val(date.IP);
                            $("#Port1").val(date.Port);
                            $("#Collector_Heartbeat_Packets1").val(date.Collector_Heartbeat_Packets);
                            $("#Heartbeat_Interval1").val(date.Heartbeat_Interval);
                            $("#Registration_Packet1").val(date.Registration_Packet);
                            //采集器状态
                            $("#Collector_Status1").combobox('select', date.Collector_Status);
                            //是否可用
                            $("#Enable1").combobox('select', date.Enable);
                            $("#Notes1").val(date.Notes);
                        });


                    }
                    else if (type == "lampcontroller")//修改该采集器下面的控制器
                    {
                        $('#dlg_lampcontroller_update').dialog('open').dialog('setTitle', '修改该采集器下的控制器');
                        $('#fm_lampcontroller_update').form('clear');
                        //异步获取控制器信息
                        $.getJSON("/DeviceManagement/BindLampControllerInfo", { ID: pid }, function (date) {
                            $("#LampControllerID1").val(date.ID);
                            //所属采集器
                            //$("#CollectorID1").combobox('setValue', date.CollectorID);

                            $("#BelongCollectorID1").combobox('select', date.CollectorID);
                            //所属控制器类型
                            $("#ControllerTypeID1").combobox('select', date.ControllerTypeID);

                            //控制器控制的路灯 默认选第一项
                            var data = $('#LightID1').combobox('getData');
                            $("#LightID1").combobox('select', data[0].value);
                            
                            //控制器地址
                            $("#Controller_Address1").val(date.Controller_Address);
                            //控制器名
                            $("#Controller_Name1").val(date.Controller_Name);

                            //控制器状态
                            $("#Controller_Status1").combobox('select', date.Controller_Status);

                            //控制器是否可用
                            $("#LampControllerEnable1").combobox('select', date.Enable);

                            //data = $('#LampControllerEnable1').combobox('getData');
                            //if (date.Enable == 0) {
                            //    $("#LampControllerEnable1").combobox('select', data[0].value);
                            //}
                            //else if (date.Enable == 1) {
                            //    $("#LampControllerEnable1").combobox('select', data[1].value);
                            //}

                            //备注
                            $("#LampControllerNotes1").val(date.Notes);

                        });
                        
                    }
                }
            }
        }

        //修改采集器信息
        function UpdateCollector() {
            //首先验证表单是否通过验证信息
            var validate = $("#fm_collector_update").form('validate');
            if (validate == false) {
                return false;
            }
            //获取传递的参数
            var postData = {

            ID: $("#CollectorID1").val(),
            Name: $("#Name1").val(),
            TypeID: $("#TypeID1").combobox('getValue'),//采集器类型编号
            IP:$("#IP1").val(),
            Port:$("#Port1").val(),
            Collector_Heartbeat_Packets:$("#Collector_Heartbeat_Packets1").val(),
            Heartbeat_Interval:$("#Heartbeat_Interval1").val(),
            Registration_Packet:$("#Registration_Packet1").val(),
            Collector_Status:$("#Collector_Status1").combobox('getValue'),
            Enable:$("#Enable1").combobox('getValue'),
            Notes:$("#Notes1").val()
              
            };

            //发送异步请求进行修改信息
            $.post("/DeviceManagement/UpdateCollectorInfo", postData, function (data) {
                if (data == "OK") {
                    //关闭层，刷新表格
                    $("#dlg_collector_update").dialog('close');
                    window.location.reload();//刷新当前页面.
                    $.messager.alert("友情提示", "修改成功!");
                }
                else {
                    $.messager.alert("友情提示", "修改失败，请您检查!");
                }
            });

        }

        //修改采集器下控制器信息
        function UpdateLampController() {
            //首先验证表单是否通过验证信息
            var validate = $("#fm_lampcontroller_update").form('validate');
            if (validate == false) {
                return false;
            }
            //获取传递的参数
            var postData = {

                ID: $("#LampControllerID1").val(),
                Controller_Name: $("#Controller_Name1").val(),
                Controller_Address: $("#Controller_Address1").val(),
                Controller_Status: $("#Controller_Status1").combobox('getValue'),
                Enable: $("#LampControllerEnable1 ").combobox('getValue'),
                ControllerTypeID: $("#ControllerTypeID1").combobox('getValue'),//控制器类型编号
                CollectorID: $("#BelongCollectorID1").combobox('getValue'),
                Notes: $("#LampControllerNotes1 ").val(),
                LightID: $("#LightID1").combobox('getValue') //控制器所控制的路灯编号

            };

            //发送异步请求进行修改信息
            $.post("/DeviceManagement/UpdateLampControllerInfo", postData, function (data) {
                if (data == "OK") {
                    //关闭层，刷新表格
                    $("#dlg_lampcontroller_update").dialog('close');
                    window.location.reload();//刷新当前页面.
                    $.messager.alert("友情提示", "修改成功!");
                }
                else {
                    $.messager.alert("友情提示", "修改失败，请您检查!");
                }
            });

        }



    </script>
   
    <style>
        article, aside, figure, footer, header, hgroup,
        menu, nav, section {
            display: block;
        }

        .west {
            width: 200px;
            padding: 10px;
        }
   </style>
</head>

<body class="easyui-layout">
    <div region="center" title="center">
        <div class="easyui-tabs" fit="true" border="false" id="DeviceManageMentTabs">
            <div title="设备管理首页">
                该模块对 采集器,控制器 进行管理.
</div>
        </div>
    </div>

    <div region="west" class="west" title="menu">
      
        <div class="easyui-panel" style="padding:5px">
            <ul id="DeviceManageMentTree"> </ul>
        </div>
       
    </div>

    <div id="DeviceManageMentTabsMenu" class="easyui-menu" style="width:120px;">
        <div name="close">关闭</div>
        <div name="Other">关闭其他</div>
        <div name="All">关闭所有</div>
    </div>

    <div id="mm" class="easyui-menu" style="width:120px;">
        <div onclick="append()" data-options="iconCls:'icon-add'">增加</div>
        <div class="menu-sep"></div>
        <div onclick="removeit()" data-options="iconCls:'icon-remove'">删除</div>
        <div class="menu-sep"></div>
        <div onclick="edit()" data-options="iconCls:'icon-edit'">修改</div>
    </div>


    <div id="dlg_lampcontroller" class="easyui-dialog" style="width: 400px; height: 400px; padding: 10px 20px"
         closed="true" resizable="true" modal="true" align="center">


        <form id="fm_lampcontroller" method="post" novalidate="novalidate">

            <table>
                <tr>
                    <th colspan="2">控制器管理</th>
                </tr>

              
                <tr>
                    <td><label for="Controller_Name">控制器名称：</label></td>
                    <td><input class="easyui-validatebox" id="Controller_Name" name="Controller_Name" required="true" /></td>
                </tr>

                <tr>
                    <td><label for="Controller_Address">控制器地址：</label></td>
                    <td><input class="easyui-validatebox" id="Controller_Address" name="Controller_Address" required="true" /></td>
                </tr>



                <tr>
                    <td><label for="Controller_Status">控制器状态：</label></td>
                    <td>
                        <select id="Controller_Status" class="easyui-combobox" name="Controller_Status">
                            <option value=1>在线</option>
                            <option value=2>离线</option>
                            <option value=3>通讯故障</option>
                        </select>
                    </td>

                </tr>


                <tr>
                    <td><label for="Enable">控制器是否启用：</label></td>
                    <td>
                        <select id="Enable" class="easyui-combobox" name="Enable">
                            <option value=0>未启用</option>
                            <option value=1>启用</option>
                        </select>
                    </td>

                </tr>

                <tr>
                    <td><label for="ControllerTypeID">控制器类别：</label></td>
                    <td>
                        <input class="easyui-combobox" name="ControllerTypeID" id="ControllerTypeID"
                               data-options="valueField:'ControllerTypeID',textField:'ControllerTypeName',
                            url:'GetControllerTypeComboboxList',required:'true'" />
                    </td>
                </tr>


                <tr hidden="hidden">
                    <td><label for="CollectorID">所属采集器：</label></td>
                    <td><input class="easyui-validatebox" id="CollectorID" name="CollectorID"/></td>
                    @*<td>
                        <input class="easyui-combobox" name="CollectorID" id="CollectorID"
                               data-options="valueField:'CollectorID',textField:'CollectorName',
                            url:'GetCollectorComboboxList',required:'true'" />
                    </td>*@
                </tr>


                <tr>
                    <td><label for="LightID">控制器所控制的路灯：</label></td>
                    <td>
                        <input class="easyui-combobox" name="LightID" id="LightID"
                               data-options="valueField:'LightID',textField:'LightName',
                            url:'GetLightComboboxList',required:'true'" />
                    </td>
                </tr>

               

                <tr>
                    <td><label for="Notes">备注：</label></td>
                    <td><input class="easyui-validatebox" id="Notes" name="Notes" required="true" /></td>
                </tr>

                <tr>
                    <td colspan="2" style="text-align:center; padding-top:10px">
                        <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-ok" onclick="save_lampcontroller()">确定</a>
                        <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-cancel"
                           onclick="javascript: $('#dlg_lampcontroller').dialog('close'); ">关闭</a>
                    </td>
                </tr>

            </table>
        </form>

    </div>

    <div id="dlg_collector" class="easyui-dialog" style="width: 500px; height: 400px; padding: 10px 20px"
         closed="true" resizable="true" modal="true" align="center">

        <form id="fm_collector" method="post" novalidate="novalidate">

            <table>
                <tr>
                    <th colspan="2">采集器管理</th>
                </tr>

               

                <tr>
                    <td><label for="Name">采集器名称：</label></td>
                    <td><input class="easyui-validatebox" id="Name" name="Name" required="true" /></td>
                </tr>

                <tr>
                    <td><label for="TypeID">采集器类别：</label></td>
                    <td>
                        <input class="easyui-combobox" name="TypeID" id="TypeID"
                               data-options="valueField:'CollectorTypeID',textField:'CollectorTypeName',
                            url:'GetCollectorTypeComboboxList',required:'true'" />
                    </td>
                </tr>


                <tr>
                    <td><label for="IP">IP地址：</label></td>
                    <td><input class="easyui-validatebox" id="IP" name="IP" required="true" /></td>
                </tr>

                <tr>
                    <td><label for="Port">端口号：</label></td>
                    <td><input class="easyui-validatebox" id="Port" name="Port" required="true" /></td>
                </tr>

                <tr>
                    <td><label for="Collector_Heartbeat_Packets">采集器心跳包：</label></td>
                    <td><input class="easyui-validatebox" id="Collector_Heartbeat_Packets" name="Collector_Heartbeat_Packets" required="true" /></td>
                </tr>

                <tr>
                    <td><label for="Heartbeat_Interval">心跳间隔：</label></td>
                    <td><input class="easyui-validatebox" id="Heartbeat_Interval" name="Heartbeat_Interval" required="true" /></td>
                </tr>

                <tr>
                    <td><label for="Registration_Packet">注册包：</label></td>
                    <td><input class="easyui-validatebox" id="Registration_Packet" name="Registration_Packet" required="true" /></td>
                </tr>


                <tr>
                    <td><label for="Collector_Status">采集器状态：</label></td>
                    <td>
                        <select id="Collector_Status" class="easyui-combobox" name="Collector_Status">
                            <option value=1>在线</option>
                            <option value=2>离线</option>
                            <option value=3>通讯故障</option>
                        </select>
                    </td>

                </tr>


                <tr>
                    <td><label for="Enable">采集器是否启用：</label></td>
                    <td>
                        <select id="Enable" class="easyui-combobox" name="Enable">
                            <option value=0>未启用</option>
                            <option value=1>启用</option>
                        </select>
                    </td>

                </tr>

                <tr>
                    <td><label for="Notes">备注：</label></td>
                    <td><input class="easyui-validatebox" id="Notes" name="Notes" required="true" /></td>
                </tr>

                <tr>
                    <td colspan="2" style="text-align:center; padding-top:10px">
                        <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-ok" onclick="save_collector()">确定</a>
                        <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-cancel"
                           onclick="javascript: $('#dlg_collector').dialog('close'); ">关闭</a>
                    </td>
                </tr>

            </table>
        </form>

    </div>

    @*----------------------------------------------修改采集器弹出框BEGIN-------------------------------------------------*@
    <div id="dlg_collector_update" class="easyui-dialog" style="width: 500px; height: 400px; padding: 10px 20px"
         closed="true" resizable="true" modal="true" align="center">

        <form id="fm_collector_update" method="post" novalidate="novalidate">

            <table>
                <tr>
                    <th colspan="2">修改采集器</th>
                </tr>

                <tr style="display:none">
                    <td><label for="CollectorID1">采集器编号：</label></td>
                    <td><input class="easyui-numberbox" id="CollectorID1" name="CollectorID1" /></td>

                </tr>

                <tr>
                    <td><label for="Name1">采集器名称：</label></td>
                    <td><input class="easyui-validatebox" id="Name1" name="Name1" required="true" /></td>
                </tr>

                <tr>
                    <td><label for="TypeID1">采集器类别：</label></td>
                    <td>
                        <input class="easyui-combobox" name="TypeID1" id="TypeID1"
                               data-options="valueField:'CollectorTypeID',textField:'CollectorTypeName',
                            url:'GetCollectorTypeComboboxList',required:'true'" />
                    </td>
                </tr>



                <tr>
                    <td><label for="IP1">IP地址：</label></td>
                    <td><input class="easyui-validatebox" id="IP1" name="IP1" required="true" /></td>
                </tr>

                <tr>
                    <td><label for="Port1">端口号：</label></td>
                    <td><input class="easyui-validatebox" id="Port1" name="Port1" required="true" /></td>
                </tr>

                <tr>
                    <td><label for="Collector_Heartbeat_Packets1">采集器心跳包：</label></td>
                    <td><input class="easyui-validatebox" id="Collector_Heartbeat_Packets1" name="Collector_Heartbeat_Packets1" required="true" /></td>
                </tr>

                <tr>
                    <td><label for="Heartbeat_Interval1">心跳间隔：</label></td>
                    <td><input class="easyui-validatebox" id="Heartbeat_Interval1" name="Heartbeat_Interval1" required="true" /></td>
                </tr>

                <tr>
                    <td><label for="Registration_Packet1">注册包：</label></td>
                    <td><input class="easyui-validatebox" id="Registration_Packet1" name="Registration_Packet1" required="true" /></td>
                </tr>


                <tr>
                    <td><label for="Collector_Status1">采集器状态：</label></td>
                    <td>
                        <select id="Collector_Status1" class="easyui-combobox" name="Collector_Status1">
                            <option value=1>在线</option>
                            <option value=2>离线</option>
                            <option value=3>通讯故障</option>
                        </select>
                    </td>

                </tr>


                <tr>
                    <td><label for="Enable1">采集器是否启用：</label></td>
                    <td>
                        <select id="Enable1" class="easyui-combobox" name="Enable1">
                            <option value=0>未启用</option>
                            <option value=1>启用</option>
                        </select>
                    </td>

                </tr>

                <tr>
                    <td><label for="Notes1">备注：</label></td>
                    <td><input class="easyui-validatebox" id="Notes1" name="Notes1" required="true" /></td>
                </tr>

                <tr>
                    <td colspan="2" style="text-align:center; padding-top:10px">
                        <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-ok" onclick="UpdateCollector()">确定</a>
                        <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-cancel"
                           onclick="javascript: $('#dlg_collector_update').dialog('close'); ">关闭</a>
                    </td>
                </tr>

            </table>
        </form>

    </div>
    @*----------------------------------------------修改采集器弹出框END-------------------------------------------------*@

    @*----------------------------------------------修改控制器弹出框BEGIN-------------------------------------------------*@
    <div id="dlg_lampcontroller_update" class="easyui-dialog" style="width: 400px; height: 400px; padding: 10px 20px"
         closed="true" resizable="true" modal="true" align="center">


        <form id="fm_lampcontroller_update" method="post" novalidate="novalidate">

            <table>
                <tr>
                    <th colspan="2">修改控制器</th>
                </tr>

                <tr style="display:none">
                    <td><label for="LampControllerID1">控制器编号：</label></td>
                    <td><input class="easyui-numberbox" id="LampControllerID1" name="LampControllerID1" /></td>

                </tr>

                <tr>
                    <td><label for="Controller_Name1">控制器名称：</label></td>
                    <td><input class="easyui-validatebox" id="Controller_Name1" name="Controller_Name1" required="true" /></td>
                </tr>

                <tr>
                    <td><label for="Controller_Address1">控制器地址：</label></td>
                    <td><input class="easyui-validatebox" id="Controller_Address1" name="Controller_Address1" required="true" /></td>
                </tr>



                <tr>
                    <td><label for="Controller_Status1">控制器状态：</label></td>
                    <td>
                        <select id="Controller_Status1" class="easyui-combobox" name="Controller_Status1">
                            <option value=1>在线</option>
                            <option value=2>离线</option>
                            <option value=3>通讯故障</option>
                        </select>
                    </td>

                </tr>


                <tr>
                    <td><label for="LampControllerEnable1">控制器是否启用：</label></td>
                    <td>
                        <select id="LampControllerEnable1" class="easyui-combobox" name="LampControllerEnable1">
                            <option value=0>未启用</option>
                            <option value=1>启用</option>
                        </select>
                    </td>

                </tr>

                <tr>
                    <td><label for="ControllerTypeID1">控制器类别：</label></td>
                    <td>
                        <input class="easyui-combobox" name="ControllerTypeID1" id="ControllerTypeID1"
                               data-options="valueField:'ControllerTypeID',textField:'ControllerTypeName',
                            url:'GetControllerTypeComboboxList',required:'true'" />
                    </td>
                </tr>


                <tr>
                    <td><label for="BelongCollectorID1">所属采集器：</label></td>
                    <td>
                        <input class="easyui-combobox" name="BelongCollectorID1" id="BelongCollectorID1"
                               data-options="valueField:'CollectorID',textField:'CollectorName',
                            url:'GetCollectorComboboxList',required:'true'" />
                    </td>
                </tr>

                <tr>
                    <td><label for="LightID1">控制器所控制的路灯：</label></td>
                    <td>
                        <input class="easyui-combobox" name="LightID1" id="LightID1"
                               data-options="valueField:'LightID',textField:'LightName',
                            url:'GetLightComboboxList',required:'true'" />
                    </td>
                </tr>


                <tr>
                    <td><label for="LampControllerNotes1">备注：</label></td>
                    <td><input class="easyui-validatebox" id="LampControllerNotes1" name="LampControllerNotes1" required="true" /></td>
                </tr>

                <tr>
                    <td colspan="2" style="text-align:center; padding-top:10px">
                        <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-ok" onclick="UpdateLampController()">确定</a>
                        <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-cancel"
                           onclick="javascript: $('#dlg_lampcontroller_update').dialog('close'); ">关闭</a>
                    </td>
                </tr>

            </table>
        </form>

    </div>
</body>
</html>

